﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Data;
using University.Workshop.Model;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for PaymentManagerTest and is intended
    ///to contain all PaymentManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class PaymentManagerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for LoadPatientPayment
        ///</summary>
        [TestMethod()]
        public void LoadPatientPaymentTest()
        {
            string ciPatient = "6736789"; // TODO: Initialize to an appropriate value
            //DataTable expected = null; // TODO: Initialize to an appropriate value
            DataTable actual;
            actual = PaymentManager.LoadPatientPayment(ciPatient);
            Assert.IsTrue(actual.Rows.Count >= 1);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for InsertPayment Null
        ///</summary>
        [TestMethod()]
        public void InsertPaymentNullTest()
        {
            Payment payment = null; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = PaymentManager.InsertPayment(payment);
            Assert.AreEqual(expected, actual);            
        }
        private Payment LoadPayment() 
        {
            Payment payment = new Payment();
            payment.CIPatient = "6733999";
            payment.CIUser = "4494524";
            payment.DatePayment = DateTime.Today.ToShortDateString();
            payment.Amount = 0;
            payment.Balance = 0;
            payment.TotalPayment = 0;
            payment.Description = "Test";
            return payment;
        }
        /// <summary>
        ///A test for InsertPayment
        ///</summary>
        [TestMethod()]
        public void InsertPaymentTest()
        {
            Payment payment = LoadPayment(); // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            actual = PaymentManager.InsertPayment(payment);
            Assert.AreEqual(expected, actual);
        }
    }
}
